package edu.gatech.cs2340.mule.model;
import java.awt.Color;
import java.io.Serializable;

/**
 * 
 * Holds the data from the GUI that the user inputted in order
 * to configure the game
 * 
 * @author Zach Elliott
 *
 */
public class GameConfigModel implements Serializable {

	private static final long serialVersionUID = 3804077016973646462L;
	
	private Player[] players;
	private String gameDifficulty;
	private String mapType;
	
	/**
	 * 
	 * @param count The number of players in the game
	 */
	public void setPlayerCount(int count) {
		players = new Player[count];
	}
	
	/**
	 * Sets the next available Player in the array to the specified settings.
	 * 
	 * @param playerColor The new Player's color.
	 * @param playerName The new Player's name.
	 * @param playerRace The new Player's race.
	 * @return boolean whether or not the Players array still has room.
	 */
	public boolean setPlayerInfo(Color playerColor, String playerName, Race playerRace) {
		int index = 0;
		while(players[index] != null) {
			index++;
		}
		players[index] = new Player(playerColor, playerName, playerRace);
		if(index == players.length - 1) {
			return false;
		}
		return true;
	}
	
	/**
	 * 
	 * @param gameDifficulty The difficulty level of the game
	 */
	public void setDifficulty(String gameDifficulty) {
		this.gameDifficulty = gameDifficulty;
	}
	
	/**
	 * 
	 * @param mapType The map type of the game
	 */
	public void setMapType(String mapType) {
		this.mapType = mapType;
	}
	
	/**
	 * 
	 * @return An array of Player objects in the game
	 */
	public Player[] getPlayers() {
		return players;
	}
	
	/**
	 * 
	 * @return The difficulty level of the game
	 */
	public String getDifficulty() {
		return gameDifficulty;
	}
	
	/**
	 * 
	 * @return The map type of the game
	 */
	public String getMapType() {
		return mapType;
	}
}
